/** 
 * 普通用户权限
 * 可以执行基础操作
 */

interface AuthyType {
    key: React.Key;
    label: string;
    authy: number; // 0 | 1
    children?: AuthyType[]
}

export const CommonAuthy: AuthyType[] = [
    {
        key: 'index',
        label: '首页',
        authy: 1,
    },
    {
        key: 'merchant',
        label: '商户管理',
        authy: 1,
        children: [
            {
                key: 'merchant_list',
                label: '商户列表',
                authy: 1,
            },
            {
                key: 'merchant_add',
                label: '添加商户',
                authy: 0,
            },
            {
                key: 'merchant_analysis',
                label: '商户分析',
                authy: 1,
            }
        ]
    },
    {
        key: 'commodity',
        label: '产品管理',
        authy: 1,
        children: [
            {
                key: 'commodity_list',
                label: '产品列表',
                authy: 1,
            },
            {
                key: 'commodity_analysis',
                label: '产品分析',
                authy: 1,
            }
        ]
    },
    {
        key: 'costomer',
        label: '客户管理',
        authy: 1,
        children: [
            {
                key: 'costomer_list',
                label: '客户列表',
                authy: 1,
            },
            {
                key: 'costomer_analysis',
                label: '客户分析',
                authy: 1,
            }
        ]
    },
    {
        key: 'business-order',
        label: '订单管理',
        authy: 1,
        children: [
            {
                key: 'bussiness-order_list',
                label: '订单列表',
                authy: 1,
            },
            {
                key: 'bussiness-order_back',
                label: '退货申请',
                authy: 1,
            },
            {
                key: 'bussiness-order_analysis',
                label: '订单分析',
                authy: 1,
            },
        ]
    },
    {
        key: 'tenders',
        label: '项目管理',
        authy: 1,
        children: [
            {
                key: 'tenders_list',
                label: '投标列表',
                authy: 1,
            }
        ]
    },
    {
        key: 'trade',
        label: '交易管理',
        authy: 1,
        children: [
            {
                key: 'trade_total-counts',
                label: '交易总量',
                authy: 1,
            },
            {
                key: 'trade_intrading',
                label: '正在交易',
                authy: 1,
            }
        ]
    },
    {
        key: 'aftermarket',
        label: '售后保障',
        authy: 1,
        children: [
            {
                key: 'aftermarket_list',
                label: '售后申请',
                authy: 1,
            },
            {
                key: 'aftermarket_analysis',
                label: '售后分析',
                authy: 1,
            },
        ]
    },
    {
        key: 'warehouse',
        label: '仓库管理',
        authy: 1,
        children: [
            {
                key: 'warehouse_material',
                label: '原材料',
                authy: 1,
            },
            {
                key: 'warehouse_product',
                label: '成品',
                authy: 1,
            },
            {
                key: 'warehouse_tools',
                label: '工具设备',
                authy: 1,
            }
        ]
    },
    {
        key: 'department',
        label: '部门管理',
        authy: 1,
        children: [
            {
                key: 'department_list',
                label: '成员列表',
                authy: 1,
            }
        ]
    },
    {
        key: 'authority',
        label: '权限管理',
        authy: 0,
        children: [
            {
                key: 'authority_setup',
                label: '特定成员',
                authy: 0,
            },
            {
                key: 'authority_depart',
                label: '部门权限',
                authy: 0,
            },
            {
                key: 'authority_position',
                label: '岗位权限',
                authy: 0,
            },
            {
                key: 'authority_accounts-list',
                label: '账号列表',
                authy: 0,
            },
            {
                key: 'authority_create-account',
                label: '生成账号',
                authy: 0,
            },
        ]
    },
];

// const _items = clone(items);

// function combineRoute(authyList: AuthyType[], item: ItemProp[]) {
//     if (!authyList) return;

//     item.forEach((v, i) => {
//         item[i].authy = authyList[i].authy;

//         if (item[i].children) {
//             combineRoute(authyList[i].children, v.children);
//         }
//     })
// }

// combineRoute(common, _items);

// export const CommonAuthy = _items;